package com.haowen.service.impl;

import com.haowen.dao.UserSongMapper;
import com.haowen.domain.UserSong;
import com.haowen.service.UserSongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserSongServiceImpl implements UserSongService {
    @Autowired
    private UserSongMapper userSongMapper;

    @Override
    public boolean addUserSong(UserSong userSong) {
        return userSongMapper.insert(userSong) > 0;
    }

    @Override
    public boolean deleteUserSong(Integer id) {
        return userSongMapper.deleteById(id) > 0;
    }

    @Override
    public boolean updateUserSong(UserSong userSong) {
        return userSongMapper.update(userSong) > 0;
    }

    @Override
    public UserSong getUserSongById(Integer id) {
        return userSongMapper.selectById(id);
    }

    @Override
    public List<UserSong> getUserSongByUserId(Integer userId) {
        return userSongMapper.selectByUserId(userId);
    }
}